﻿using System;
using System.ComponentModel;
using Toolbox.Plugin.Components;
using Toolbox.Plugin.Interfaces;


namespace Toolbox.Plugin.File
{
    partial class PluginFileHandler : Component, IPluginFileHandler
    {
        public PluginFileHandler()
        {
            InitializeComponent();
        }

        public PluginFileHandler(IContainer container)
        {
            container.Add(this);

            InitializeComponent();
        }


        #region PluginProvider Management

        private PluginProvider Provider;

        [Category("Plugin")]
        [DisplayName("Plugin Provider")]
        [ImmutableObject(true)]
        public PluginProvider PluginProvider
        {
            get { return this.Provider; }
            set { this.Provider = value; }
        }

        #endregion

        [Category("Plugin")]
        public event ProgressChangedEventHandler FileLoading;
        [Category("Plugin")]
        public event ProgressChangedEventHandler FileSaving;
        [Category("Plugin")]
        public event RunWorkerCompletedEventHandler FileLoaded;
        [Category("Plugin")]
        public event RunWorkerCompletedEventHandler FileSaved;

        #region Export

        public void Export(string filename)
        {
        }

        public event EventHandler FileExported;

        protected virtual void OnFileExport(IPluginExporter sender)
        {
            if (this.FileSaved != null)
            {
                //this.FileSaved(this, new RunWorkerCompletedEventArgs());
            }
        }

        #endregion

        #region Import

        public void Import(string filename)
        {
        }

        public event EventHandler FileImported;

        protected virtual void OnFileImport(IPluginImporter sender)
        {
            if (this.FileLoaded != null)
            {
               // this.FileLoaded(this, new EventArgs());
            }
        }

        #endregion



    }
}
